var tz15 = "#fEffect/CharacterEff/1112949/0/0#"; //花样音符
var status = -1;
var itemList = Array(
Array(1702764, 1000, 1, 1),
Array(1702758, 1000, 1, 1),
Array(1702753, 1000, 1, 1),
Array(1702752, 1000, 1, 1),
Array(1702750, 1000, 1, 1),
Array(1702749, 1000, 1, 1),
Array(1702748, 1000, 1, 1),
Array(1702742, 1000, 1, 1),
Array(1702740, 1000, 1, 1),
Array(1702738, 1000, 1, 1),
Array(1702725, 1000, 1, 1),
Array(1702726, 1000, 1, 1),
Array(1702718, 1000, 1, 1),
Array(1702717, 1000, 1, 1),
Array(1702712, 1000, 1, 1),
Array(1702707, 1000, 1, 1),
Array(1702705, 1000, 1, 1),
Array(1702704, 1000, 1, 1),
Array(1702701, 1000, 1, 1),
Array(1702699, 1000, 1, 1),
Array(1702694, 1000, 1, 1),
Array(1702695, 1000, 1, 1),
Array(1702696, 1000, 1, 1),
Array(1702697, 1000, 1, 1),
Array(1702691, 1000, 1, 1),
Array(1702681, 1000, 1, 1),
Array(1702680, 1000, 1, 1),
Array(1702657, 1000, 1, 1),
Array(1702655, 1000, 1, 1),
Array(1702666, 1000, 1, 1),
Array(1702665, 1000, 1, 1),
Array(1702667, 1000, 1, 1),
Array(1702656, 1000, 1, 1),
Array(1702556, 1000, 1, 1),
Array(1702544, 1000, 1, 1),
Array(1702528, 1000, 1, 1),
Array(1702472, 1000, 1, 1),
Array(1702423, 1000, 1, 1),
Array(1004881, 1000, 1, 1),
Array(1004776, 1000, 1, 1),
Array(1003843, 1000, 1, 1),
Array(1003924, 1000, 1, 1),
Array(1004961, 1000, 1, 1),
Array(1004884, 1000, 1, 1),
Array(1004789, 1000, 1, 1),
Array(1004788, 1000, 1, 1),
Array(1004787, 1000, 1, 1),
Array(1004756, 1000, 1, 1),
Array(1004738, 1000, 1, 1),
Array(1004727, 1000, 1, 1),
Array(1004726, 1000, 1, 1),
Array(1004610, 1000, 1, 1),
Array(1004296, 1000, 1, 1),
Array(1004295, 1000, 1, 1),
Array(1082553, 1000, 1, 1),
Array(1082700, 1000, 1, 1),
Array(1053049, 1000, 1, 1),
Array(1053156, 1000, 1, 1),
Array(1053155, 1000, 1, 1),
Array(1053138, 1000, 1, 1),
Array(1053120, 1000, 1, 1),
Array(1053103, 1000, 1, 1),
Array(1053090, 1000, 1, 1),
Array(1053089, 1000, 1, 1),
Array(1053085, 1000, 1, 1),
Array(1053084, 1000, 1, 1),
Array(1053083, 1000, 1, 1),
Array(1053082, 1000, 1, 1),
Array(1042275, 1000, 1, 1),
Array(1053052, 1000, 1, 1),
Array(1042294, 1000, 1, 1),
Array(1053035, 1000, 1, 1),
Array(1053053, 1000, 1, 1),
Array(1053033, 1000, 1, 1),
Array(1049003, 1000, 1, 1),
Array(1049004, 1000, 1, 1),
Array(1049002, 1000, 1, 1),
Array(1062210, 1000, 1, 1),
Array(1062204, 1000, 1, 1),
Array(1062112, 1000, 1, 1),
Array(1042162, 1000, 1, 1),
Array(1102604, 1000, 1, 1),
Array(1102188, 1000, 1, 1),
Array(1102187, 1000, 1, 1),
Array(1102995, 1000, 1, 1),
Array(1102994, 1000, 1, 1),
Array(1102990, 1000, 1, 1),
Array(1102983, 1000, 1, 1),
Array(1102977, 1000, 1, 1),
Array(1102974, 1000, 1, 1),
Array(1102973, 1000, 1, 1),
Array(1102975, 1000, 1, 1),
Array(1102976, 1000, 1, 1),
Array(1102971, 1000, 1, 1),
Array(1102970, 1000, 1, 1),
Array(1102969, 1000, 1, 1),
Array(1102968, 1000, 1, 1),
Array(1102950, 1000, 1, 1),
Array(1102930, 1000, 1, 1),
Array(1102937, 1000, 1, 1),
Array(1113003, 1000, 1, 1),
Array(1113228, 1000, 1, 1),
Array(1073185, 1000, 1, 1),
Array(1073150, 1000, 1, 1),
Array(1073127, 1000, 1, 1),
Array(1073109, 1000, 1, 1),
Array(1012573, 1000, 1, 1),
Array(1012592, 1000, 1, 1),
Array(1012602, 1000, 1, 1),
Array(1012593, 1000, 1, 1),
Array(1012574, 1000, 1, 1),
Array(1012606, 1000, 1, 1),
Array(1012576, 1000, 1, 1),
Array(1012608, 1000, 1, 1),
Array(1012503, 1000, 1, 1),
Array(1012575, 1000, 1, 1),
Array(1012526, 1000, 1, 1),
Array(1012594, 1000, 1, 1),
Array(1012579, 1000, 1, 1),
Array(1012604, 1000, 1, 1),
Array(1012577, 1000, 1, 1),
Array(1012589, 1000, 1, 1),
Array(1012607, 1000, 1, 1),
Array(1012596, 1000, 1, 1),
Array(1012595, 1000, 1, 1),
Array(1012597, 1000, 1, 1)

);

var itemList2 = Array(	

);

var itemList3 = Array(	
	
);

var itemList4 = Array(

);	

var itemList5 = Array(

	
);

var itemList6 = Array(
 
);


function action(mode, type, selection) {
	if (mode == 1) {
		status++;
	} else {
		if (status === 0) {
			cm.sendOk("不想使用吗？…我的肚子里有各类#b暖暖装扮#k哦！");
			cm.dispose();
		}
		status--;
	}
	if (status === 0) {
		if (cm.haveItem(4310209)) {
			cm.sendYesNo("            #e" + tz15 + "#r『水波暖暖转蛋机』 " + tz15 + "\r\n#k使用“#b1个#t4310209##k”就可以交换. 可在市场兑换。\r\n#d比普通转蛋机的几率要高200% #k现在要玩转蛋机么?\r\n———————————————————————— \r\n");
		} else {
			cm.sendOk("            #e" + tz15 + "#r『水波暖暖转蛋机』 " + tz15 + "\r\n#k使用“#b1个#t4310209##k”就可以交换. 可在市场兑换。\r\n#d比普通转蛋机的几率要高200% #k现在要玩转蛋机么?\r\n———————————————————————— \r\n你背包里好像没有#b#t4310209##k哦!");
			cm.safeDispose();
		}
	} else if (status == 1) {
		var chance = Math.floor(Math.random() * 800);
		var finalitem = new Array();
		for (var i = 0; i < itemList.length; i++) {
			if (itemList[i][1] >= chance) {
				finalitem.push(itemList[i]);
			}
		}
		for (i = 0; i < itemList2.length; i++) {
			if (itemList2[i][1] >= chance) {
				finalitem.push(itemList2[i]);
			}
		}
		for (i = 0; i < itemList3.length; i++) {
			if (itemList3[i][1] >= chance) {
				finalitem.push(itemList3[i]);
			}
		}
		for (i = 0; i < itemList4.length; i++) {
			if (itemList4[i][1] >= chance) {
				finalitem.push(itemList4[i]);
			}
		}
		for (i = 0; i < itemList5.length; i++) {
			if (itemList5[i][1] >= chance) {
				finalitem.push(itemList5[i]);
			}
		}
		for (i = 0; i < itemList6.length; i++) {
			if (itemList6[i][1] >= chance) {
				finalitem.push(itemList6[i]);
			}
		}
		if (finalitem.length !== 0) {
			var random = new java.util.Random();
			var finalchance = random.nextInt(finalitem.length);
			var itemId = finalitem[finalchance][0];
			var quantity = finalitem[finalchance][2];
			var notice = finalitem[finalchance][3];
			if (cm.haveItem(4310209) && cm.canHold()) {
				if (notice == 1) {
					cm.gainGachaponItem(itemId, quantity, "暖暖转蛋机");
				} else {
					cm.gainItem(itemId, quantity);
				}
				cm.gainItem(4310209, -1);
				cm.sendOk("你获得了 #b#t" + itemId + "##k " + quantity + "个。");
			} else {
				cm.sendOk("你确实有#b#t4310209##k吗？如果是，请你确认在背包的装备，消耗，其他窗口中是否有一格以上的空间。");
			}
			cm.safeDispose();
		} else {
			cm.sendOk("#r(获得了安慰奖：星星 20 个。)\r\n今天的运气可真差，什么都没有拿到。");
			cm.gainItem(4310209, -1);
			cm.gainItem(4001839, 20);
			cm.safeDispose();
		}
	} else {
		cm.dispose();
	}
}




















/*function start() {
 status = -1;
 cm.sendSimple("勋章转蛋机中有各类暖暖装扮#k噢！使用“#b#t4310209##k”就可以交换. 刷boss就有很多啦。 现在要玩转蛋机么？\r\n你可以选择以下转蛋机哦\r\n#L0##p9330112#\r\n#L1##p9330113#\r\n#L2##p9330114#\r\n#L3##p9330115#\r\n#L4##p9330116#\r\n#L6##p9330118#\r\n");
 }
 
 
 function action(mode, type, selection) {
 
 if (mode == 1) {
 status++;
 } else {
 if (status == 0) {
 cm.sendOk("不想使用吗？…我的肚子里有各类#b暖暖装扮#k哦！");
 cm.dispose();
 }
 status--;
 }
 
 if (status == 0) {
 //cm.sendOk("在冒险岛生活还愉快吗？");
 //cm.dispose();
 cm.dispose();
 cm.openNpc(9330112+selection,null);
 return;
 
 
 }
 cm.dispose();
 }*/